namespace Kiwi.Container.Lifetime
{
    public class StartableLifetimePolicy : ILifetimePolicy
    {
        #region ILifetimePolicy Members

        public object StartLife(object component)
        {
            var startable = component as IStartableComponent;
            if (startable != null)
            {
                startable.StartComponent();
            }
            return component;
        }

        public object EndLife(object component)
        {
            var startable = component as IStartableComponent;
            if (startable != null)
            {
                startable.StopComponent();
            }
            return component;
        }

        #endregion
    }
}